//
//  ViewController.m
//  oc_31
//
//  Created by 楼楚 on 15/9/19.
//  Copyright (c) 2015年 Chu Lou. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView *_tabView;
    NSMutableArray *dataArr;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _tabView = [[UITableView alloc]initWithFrame:(CGRect){0,0,[UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height}];
    [self.view addSubview:_tabView];
    _tabView.delegate = self;
    _tabView.dataSource =self;
    dataArr = [[NSMutableArray alloc]init];
    for (int i; i < 8; ++i) {
        [dataArr addObject:[NSString stringWithFormat:@"第%d行",i +1]];
    }
    
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return  45;
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return  dataArr.count;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    cell.textLabel.text = dataArr[indexPath.row];
    return cell;
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [dataArr removeObjectAtIndex:indexPath.row];
    [_tabView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
